home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 22 / Amiga Format AFCD22 (Jan 1998, Issue 106).iso / -in_the_mag- / converters / graphics / netpbm / hpcdtoppm.0.6 / src / error.c < prev    next >
C/C++ Source or Header  |  1997-11-16  |  10KB  |  130 lines

  1. /* hpcdtoppm (Hadmut's pcdtoppm) v0.6
  2. *  Copyright (c) 1992, 1993, 1994 by Hadmut Danisch (danisch@ira.uka.de).
  3. *  Permission to use and distribute this software and its
  4. *  documentation for noncommercial use and without fee is hereby granted,
  5. *  provided that the above copyright notice appear in all copies and that
  6. *  both that copyright notice and this permission notice appear in
  7. *  supporting documentation. It is not allowed to sell this software in 
  8. *  any way. This software is not public domain.
  9. */
  10.  
  11. #include "hpcdtoppm.h"
  12. #define X(a,b) ((a == b) ? "->" : "  ")
  13.  
  14. void eerror(enum ERRORS e,char *file,int line)
  15.  {
  16.   
  17.   switch(e)
  18.    {case E_NONE:   return;
  19.     case E_IMP:    fprintf(stderr,"Sorry, Not yet implemented. [%s:%d]\n",file,line); break;
  20.     case E_READ:   fprintf(stderr,"Error while reading.\n"); break;
  21.     case E_WRITE:  fprintf(stderr,"Error while writing.\n"); break;
  22.     case E_INTERN: fprintf(stderr,"Internal error. [%s:%d]\n",file,line); break;
  23.     case E_ARG:    fprintf(stderr,"Error in Arguments !\n\n"); 
  24. #ifdef SHORT_HELP
  25.                    fprintf(stderr,"Usage: hpcdtoppm [options] pcd-file [ppm-file]\n");
  26.                    fprintf(stderr,"       ( - means stdin )\n");
  27.                    fprintf(stderr,"Opts:         [ -> = Default ] \n\n");
  28.                    fprintf(stderr,"   [-x] [-s] [-d] [-i] [-m]\n");
  29.                    fprintf(stderr,"   [-crop] [-pos] [-rep] [-vert] [-hori] [-S h v]\n");
  30.                    fprintf(stderr,"   [-n] [-r] [-l] [-h] [-a]\n");
  31.                    fprintf(stderr,"   [-ppm] [-pgm] [-ycc] [-ps] [-eps] [-psg] [-epsg] [-psd] [-epsd] [-jpeg]\n");
  32.                    fprintf(stderr,"   [-optimize] [-quality N] [-maxmemory N]\n");
  33.                    fprintf(stderr,"   [-pl f] [-pb f] [-pw f] [-ph f] [-dpi f] [-fak f]\n");
  34.                    fprintf(stderr,"   [-c0] [-c-] [-c+]\n");
  35.                    fprintf(stderr,"   [-0] [-C d s] [-1] [-2] [-3] [-4] [-5] [-6]\n");
  36.  
  37. #endif
  38. #ifdef LONG_HELP
  39.                    fprintf(stderr,"Usage: hpcdtoppm [options] pcd-file [ppm-file]\n");
  40.                    fprintf(stderr,"       ( - means stdin )\n");
  41.                    fprintf(stderr,"Opts:         [ -> = Default ] \n\n");
  42.  
  43.                    fprintf(stderr,"     -x     Overskip mode (tries to improve color quality.)\n");
  44.                    fprintf(stderr,"     -s     Apply simple sharpness-operator on the Luma-channel.\n");
  45.                    fprintf(stderr,"     -d     Show differential picture only.\n");
  46.                    fprintf(stderr,"     -i     Give some (buggy) informations from fileheader.\n");
  47.                    fprintf(stderr,"     -m     Show the decoding steps to stderr.\n");
  48.                    fprintf(stderr,"     -crop  Try to cut off the black frame.\n");
  49.                    fprintf(stderr,"     -pos   Print file position of image to stderr.\n");
  50.                    fprintf(stderr,"     -rep   Try to jump over defects in the Huffman Code.\n");
  51.                    fprintf(stderr,"     -vert  Flip image vert.\n");
  52.                    fprintf(stderr,"     -hori  Flip image horiz.\n");
  53.                    fprintf(stderr,"     -S h v Decode subrectangle with hori. and vert. boundaries h,v,\n");
  54.                    fprintf(stderr,"            h,v of the form a-b or a+b, a and b integer or float [0.0...1.0]\n");
  55.                    fprintf(stderr,"\n");
  56.  
  57.                    fprintf(stderr," %s  -n     Don't rotate.\n",                                 X(T_DEFAULT,T_NONE));
  58.                    fprintf(stderr," %s  -r     Rotate clockwise for portraits.\n" ,              X(T_DEFAULT,T_RIGHT));
  59.                    fprintf(stderr," %s  -l     Rotate counter-clockwise for portraits.\n",       X(T_DEFAULT,T_LEFT));
  60.                    fprintf(stderr," %s  -h     Rotate twice, turn on head.\n",                   X(T_DEFAULT,T_HEAD));
  61.                    fprintf(stderr," %s  -a     Try to find out orientation automatically.\n",    X(T_DEFAULT,T_AUTO));
  62.                    fprintf(stderr,"\n");
  63.  
  64.                    fprintf(stderr," %s  -ppm   output rgb  (ppm-format). \n",                    X(O_DEFAULT,O_PPM));
  65.                    fprintf(stderr," %s  -pgm   output gray (pgm-format). \n",                    X(O_DEFAULT,O_PGM));
  66.                    fprintf(stderr," %s  -ycc   output ycc  (ppm-format). \n",                    X(O_DEFAULT,O_YCC));
  67.                    fprintf(stderr," %s  -ps    output postscript (rgb). \n",                     X(O_DEFAULT,O_PS));
  68.                    fprintf(stderr," %s  -eps   output encapsulated postscript (rgb). \n",        X(O_DEFAULT,O_EPS));
  69.                    fprintf(stderr," %s  -psg   output postscript (grayscale). \n",               X(O_DEFAULT,O_PSG));
  70.                    fprintf(stderr," %s  -epsg  output encapsulated postscript (grayscale). \n",  X(O_DEFAULT,O_EPSG));
  71.                    fprintf(stderr," %s  -psd   output postscript (b&w dithered). \n",            X(O_DEFAULT,O_PSG));
  72.                    fprintf(stderr," %s  -epsd  output encapsulated postscript (b&w dithered).\n",X(O_DEFAULT,O_EPSG));
  73.                    fprintf(stderr," %s  -jpeg  output JPEG. \n",X(O_DEFAULT,O_JPEG));
  74.                    fprintf(stderr,"       -optimize     optimize Huffman table\n");
  75.                    fprintf(stderr,"       -quality   N  compression quality (0..100; 5-95 is useful range)\n");
  76.                    fprintf(stderr,"       -maxmemory N  max. memory for JPEG encoding (in kbytes)\n");
  77.                    fprintf(stderr,"     -pl  f Postscript paper left position    [ Def:  %8.3f ]\n",DEF_PAPER_LEFT);
  78.                    fprintf(stderr,"     -pb  f Postscript paper bottom position  [ Def:  %8.3f ]\n",DEF_PAPER_BOTTOM);
  79.                    fprintf(stderr,"     -pw  f Postscript paper width            [ Def:  %8.3f ]\n",DEF_PAPER_WIDTH);
  80.                    fprintf(stderr,"     -ph  f Postscript paper height           [ Def:  %8.3f ]\n",DEF_PAPER_HEIGHT);
  81.                    fprintf(stderr,"     -dpi f Postscript resolution for dith.   [ Def:  %8.3f ]\n",DEF_DPI);
  82.                    fprintf(stderr,"     -fak f Scaling factor for dith.          [ Def:     1.0   ]\n");
  83.                    fprintf(stderr,"\n");
  84.  
  85.                    fprintf(stderr," %s  -c0    don't correct (linear).\n", X(C_DEFAULT,C_LINEAR));
  86.                    fprintf(stderr," %s  -c-    correct darker.\n",         X(C_DEFAULT,C_DARK));
  87.                    fprintf(stderr," %s  -c+    correct brighter.\n",       X(C_DEFAULT,C_BRIGHT));
  88.                    fprintf(stderr,"\n");
  89.  
  90.                    fprintf(stderr," %s  -0     Extract thumbnails from Overview file.\n",        X(S_DEFAULT,S_Over));
  91.                    fprintf(stderr," %s  -C d s Extract contact sheet from Overview file, d images width,\n",X(S_DEFAULT,S_Contact)); 
  92.                    fprintf(stderr,"            with contact sheet orientation s ( one of n l r h).\n");
  93.                    fprintf(stderr," %s  -1     Extract  128x192   from Image file.\n",           X(S_DEFAULT,S_Base16));
  94.                    fprintf(stderr," %s  -2     Extract  256x384   from Image file.\n",           X(S_DEFAULT,S_Base4));
  95.                    fprintf(stderr," %s  -3     Extract  512x768   from Image file.\n",           X(S_DEFAULT,S_Base));
  96.                    fprintf(stderr," %s  -4     Extract 1024x1536  from Image file.\n",           X(S_DEFAULT,S_4Base));
  97.                    fprintf(stderr," %s  -5     Extract 2048x3072  from Image file.\n",           X(S_DEFAULT,S_16Base));
  98.                    fprintf(stderr," %s  -6     Extract 4096x6144  from Image file and 64Base-Directory.\n",           X(S_DEFAULT,S_64Base));
  99.                    fprintf(stderr,"\n");
  100. #endif
  101.                    break;
  102.     case E_OPT:    fprintf(stderr,"These Options are not allowed together.\n");break;
  103.     case E_MEM:    fprintf(stderr,"Not enough memory !\n"); break;
  104.     case E_HUFF:   fprintf(stderr,"Error in Huffman-Code-Table\n"); break;
  105.     case E_SEQ:    fprintf(stderr,"Error in Huffman-Sequence, try option -rep\n"); break;
  106.     case E_SEQ1:   fprintf(stderr,"Error1 in Huffman-Sequence, try option -rep\n"); break;
  107.     case E_SEQ2:   fprintf(stderr,"Error2 in Huffman-Sequence, try option -rep\n"); break;
  108.     case E_SEQ3:   fprintf(stderr,"Error3 in Huffman-Sequence, try option -rep\n"); break;
  109.     case E_SEQ4:   fprintf(stderr,"Error4 in Huffman-Sequence, try option -rep\n"); break;
  110.     case E_SEQ5:   fprintf(stderr,"Error5 in Huffman-Sequence, try option -rep\n"); break;
  111.     case E_SEQ6:   fprintf(stderr,"Error6 in Huffman-Sequence, try option -rep\n"); break;
  112.     case E_SEQ7:   fprintf(stderr,"Error7 in Huffman-Sequence, try option -rep\n"); break;
  113.     case E_POS:    fprintf(stderr,"Error in file-position\n"); break;
  114.     case E_OVSKIP: fprintf(stderr,"Can't read this resolution in overskip-mode\n"); break;
  115.     case E_TAUTO:  fprintf(stderr,"Can't determine the orientation in overview mode\n");break;
  116.     case E_SUBR:   fprintf(stderr,"Error in Subrectangle Parameters\n");break;
  117.     case E_PRPAR:  fprintf(stderr,"Bad printing parameters\n");break;
  118.     case E_CONFIG: fprintf(stderr,"Something is wrong with your configuration [see %s:%d]\n",file,line);
  119.                    fprintf(stderr,"Edit the config.h and recompile...\n"); break;
  120.     case E_TCANT:  fprintf(stderr,"Sorry, can't determine orientation for this file.\n");
  121.                    fprintf(stderr,"Please give orientation parameters. \n");break;
  122.     case E_FOPEN:  fprintf(stderr,"Can't open file\n"); break;
  123.     default:       fprintf(stderr,"Unknown error %d ???  [%s:%d]\n",e,file,line);break;
  124.    }
  125.   close_all();
  126.   exit(9);
  127.  }
  128.  
  129.  
  130.